package com.sgb.kjwl.view.ui.activity.enterprise;

import android.content.Context;
import android.content.Intent;

import androidx.databinding.DataBindingUtil;

import com.sgb.kjwl.AppActivity;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ActivityServicequoteDetailBinding;
import com.sgb.kjwl.databinding.ActivityTalentUserdetailBinding;
import com.sgb.kjwl.di.enterprise.DaggerEnterpriseComponent;
import com.sgb.kjwl.di.enterprise.EnterpriseModule;
import com.sgb.kjwl.model.entity.enterprise.ServiceQuoteEntity;
import com.sgb.kjwl.viewmodel.enterprise.SeverQuoteDetailModel;
import com.sgb.kjwl.viewmodel.enterprise.TalentDeilModel;
import com.swgk.core.base.di.AppComponent;
import com.swgk.core.util.DateUtils;

import java.io.Serializable;

import javax.inject.Inject;

public class SeverQuoteDetailActivity extends AppActivity {
    private ActivityServicequoteDetailBinding binding;
    @Inject
    SeverQuoteDetailModel makeOverDetailModel;

    @Override
    protected void setupActivityComponent(AppComponent appComponent) {
        DaggerEnterpriseComponent.builder().appComponent(appComponent)
                .enterpriseModule(new EnterpriseModule(this))
                .build()
                .inject(this);
    }


    public static void start(Context mContext, ServiceQuoteEntity entity) {
        Intent mIntent = new Intent();
        mIntent.putExtra("data", (Serializable) entity);
        mIntent.setClass(mContext, SeverQuoteDetailActivity.class);
        mContext.startActivity(mIntent);
    }


    @Override
    protected void initView() {
        super.initView();
        binding = DataBindingUtil.setContentView(this, R.layout.activity_servicequote_detail);
        binding.ivBack.setOnClickListener(view -> finish());
        ServiceQuoteEntity entity = (ServiceQuoteEntity) getIntent().getSerializableExtra("data");
        if (entity != null) {
            binding.setModel(entity);
            if (entity.getService_date() != null && !entity.getService_date().contains("-")) {
                long serviceDate = Long.parseLong(entity.getService_date());
                binding.tvTimeconetnt.setText(DateUtils.timestampToDate(serviceDate));
            } else {
                binding.tvTimeconetnt.setText(entity.getService_date());
            }
        }
    }
}
